package org.wolfengi.monitor.service.impl;

import org.wolfengi.monitor.common.ShipCN;
import org.wolfengi.monitor.entity.FShipTypeCount;
import org.wolfengi.monitor.mapper.FShipTypeCountMapper;
import org.wolfengi.monitor.service.FShipTypeCountService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author wolfengi
 * @since 2020-05-20
 */
@Service
public class FShipTypeCountServiceImpl extends ServiceImpl<FShipTypeCountMapper, FShipTypeCount> implements FShipTypeCountService {

    @Autowired
    private FShipTypeCountMapper fShipTypeCountMapper;

    @Override
    public List<String> selectYears() {
        return fShipTypeCountMapper.selectYears();
    }

    @Override
    public List<Map> selectCountByYear(String year) {
        List<Map> maps = fShipTypeCountMapper.selectCountByYear(year);
        maps.forEach(l->{
            String cn = ShipCN.getCNTrim(l.get("type").toString());
            l.put("cn",cn);
        });
        return maps;
    }
}
